package com.itheima.web.controller.ums;

import com.itheima.common.core.model.AjaxResult;
import com.itheima.pojo.ums.UmsAdminLoginParam;
import com.itheima.service.ums.AdminService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

@RestController
@RequestMapping("admin")
@Slf4j
public class AdminController {

    @DubboReference
    private AdminService adminService;

    @PostMapping("login")
    public AjaxResult login(@RequestBody UmsAdminLoginParam umsAdminLoginParam){
        log.info("用户登录信息：{}",umsAdminLoginParam);
        AjaxResult ajaxResult = adminService.login(umsAdminLoginParam);
        return ajaxResult;
    }

    @GetMapping("info")
    public AjaxResult info(){
        HashMap<String ,Object> map = adminService.info();
        return AjaxResult.success("操作成功",map);
    }
}
